﻿using System;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine("请输入数组并以空格相隔");
        string input = Console.ReadLine();

        if (string.IsNullOrWhiteSpace(input))
        {
            Console.WriteLine("输入不能为空");
            return;
        }

        try
        {
            int[] nums = input.Split(' ').Select(int.Parse).ToArray();

            if (nums.Length == 0)
            {
                Console.WriteLine("数组为空");
                return;
            }

            int maxVal = nums.Max();
            int minVal = nums.Min();
            int sum = nums.Sum();
            double avg = nums.Average();

            Console.WriteLine($"最大值: {maxVal}");
            Console.WriteLine($"最小值: {minVal}");
            Console.WriteLine($"平均值: {avg:F2}"); // 两位小数
            Console.WriteLine($"总和: {sum}");
        }
        catch (FormatException)
        {
            Console.WriteLine("输入格式错误");
        }
    }
}

